package org.zoomdev.zoom.dao.adapters.result;

import org.zoomdev.zoom.dao.adapters.ResultSetAdapter;

import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Clob2StringResultSetAdapter implements ResultSetAdapter {

    public static final ResultSetAdapter ADAPTER = new Clob2StringResultSetAdapter();


    public Clob2StringResultSetAdapter() {

    }

    @Override
    public Object getObject(ResultSet rs, int columnIndex) throws SQLException {
        Clob blob = rs.getClob(columnIndex);
        return blob.getSubString(1L, (int) blob.length());
    }
}
